<form id="info-form" method="post">
    <table>
        <input type="hidden" name="id" value="@if(!empty($info)){{$info['id']}}@endif" />
        <tr>
            <td width="60" align="right">上级分类:</td>
            <td><input name="parent_id" id="cate_name" value="" /></td>
        </tr>
        <tr>
            <td align="right">分类名称:</td>
            <td><input type="text" name="name" class="wu-text" value="@if(!empty($info)){{$info['name']}}@endif" /></td>
        </tr>
    </table>
</form>

<script type="text/javascript">
    $(function(){
        $('#cate_name').combotree({
            url: '/product/cate/tree',
            queryParams:{
                _token : $('meta[name="csrf-token"]').attr('content')
            }
        });

        var rows = $('#listGrid').treegrid('getSelected');
        if (null == rows) {
            return;
        }

        @if(!empty($info))
            @if($info['parent_id'])
            $('#cate_name').combotree('setValue',{id:'{{$info['parent_id']}}'});
            @endif
        @else
            $('#cate_name').combotree('setValue',{id:rows.id, text:rows.name});
        @endif
    });

</script>